<!--  -->
<template>
<div>


  <h2 style="">启动前端服务器</h2>
  <el-row :gutter="24">
    <el-col :span="6">
      <div class="lightgreen-box">
        <div style="padding: 25px;">
          <span><span><el-button type="text" class="button_1" @click="startNginx()">启动Nginx</el-button></span></span>
        </div>
      </div>
    </el-col>


  </el-row>

    <h2 style="">质量追溯服务</h2>
<el-row :gutter="24">
      <el-col :span="6">
        <div class="lightgreen-box">
          <i class="el-icon-tickets" style="font-size: 50px;"></i>
      <div style="padding: 25px;">
        <span>  <span><el-button type="text" class="button_1" @click="startP4()">启动服务</el-button></span></span>
        <span>  <span><el-button type="text" class="button_1" @click="statusP4()">项目状态</el-button></span></span>
        <span>  <span><el-button type="text" class="button_1" @click="shutP4()">关闭服务</el-button></span></span>
        <a href="http://localhost:132/" target="_blank">质量追溯</a>
      </div>
        </div>
      </el-col>


    </el-row>

<!--    <el-divider></el-divider>-->
    <h2 style="">设备监测服务</h2>
    <el-row :gutter="24">
      <el-col :span="6">
        <div class="lightgreen-box">
          <i class="el-icon-setting" style="font-size: 50px;"></i>
      <div style="padding: 25px;">
        <span>  <span><el-button type="text" class="button_1" @click="startP2()">启动服务</el-button></span></span>
        <span>  <span><el-button type="text" class="button_1" @click="statusP2()">项目状态</el-button></span></span>
        <span>  <span><el-button type="text" class="button_1" @click="shutP2()">关闭服务</el-button></span></span>
        <a href="http://localhost:8443" target="_blank"  >设备监测</a>
      </div>
        </div>
      </el-col>

    </el-row>

  <h2 style="">工序排产服务</h2>
  <el-row :gutter="24">
    <el-col :span="6">
      <div class="lightgreen-box">
        <i class="el-icon-setting" style="font-size: 50px;"></i>
        <div style="padding: 25px;">
          <span>  <span><el-button type="text" class="button_1" @click="startP3()">启动服务</el-button></span></span>
          <span>  <span><el-button type="text" class="button_1" @click="statusP3()">项目状态</el-button></span></span>
          <span>  <span><el-button type="text" class="button_1" @click="shutP3()">关闭服务</el-button></span></span>
          <a href="http://localhost:133" target="_blank" >工序排产</a>
        </div>
      </div>
    </el-col>
  </el-row>

  <h2 style="">要素感知服务</h2>
  <el-row :gutter="24">
    <el-col :span="6">
      <div class="lightgreen-box">
        <i class="el-icon-setting" style="font-size: 50px;"></i>
        <div style="padding: 25px;">
          <span>  <span><el-button type="text" class="button_1" @click="startP1()">启动服务</el-button></span></span>
          <span>  <span><el-button type="text" class="button_1" @click="statusP1()">项目状态</el-button></span></span>
          <span>  <span><el-button type="text" class="button_1" @click="shutP1()">关闭服务</el-button></span></span>
          <a href="http://localhost:134"  target="_blank">要素感知</a>
        </div>
      </div>
    </el-col>
  </el-row>


</div>

</template>

<script>
// eslint-disable-next-line no-unused-vars
import axios from 'axios'
// eslint-disable-next-line no-unused-vars
// 这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
// 例如：import 《组件名称》 from '《组件路径》';
export default {
// import引入的组件需要注入到对象中才能使用
  components: {},
  data () {
// 这里存放数据
    return {

    }
  },
// 监听属性 类似于data概念
  computed: {},
// 监控data中的数据变化
  watch: {},
// 方法集合
  methods: {
    startP4 () {
      this.$http({
        url: this.$http.adornUrl('/generator/ceshi/testStartP4'),
        method: 'post'
      })
      alert('正在启动项目请等待')
    },
    shutP4 () {
      // var config = {}
      // Vue.cookie.get('token')
      // axios.get('/proxyApi/generator/ceshi/testShut', config)
      this.$http({
        url: this.$http.adornUrl('/subProjectControl/ShutP4'),
        method: 'post'
      })
    },
    statusP4 () {
      axios.get('/status/nacos/v1/ns/catalog/instances?serviceName=retrospect&clusterName=retrospect&groupName=AIMS&pageSize=10&pageNo=1&namespaceId=').then(result => {
        console.log(result.data)
        if (result.data.list != null && result.status === 200) { alert('项目已启动端口号为：' + result.data.list[0].port) } else {
          alert('项目尚未启动')
        }
      })
    },

    startP2 () {
      this.$http({
        url: this.$http.adornUrl('/generator/ceshi/testStartP2'),
        method: 'post'
      })
      alert('正在启动项目请等待')
    },
    shutP2 () {
      this.$http({
        url: this.$http.adornUrl('/generator/ceshi/testShutP2'),
        method: 'post'
      })
    },
    statusP2 () {
      this.$http({
        url: this.$http.adornUrl('/generator/ceshi/statusP2'),
        method: 'get'
      }).then(result => {
        alert(result.data)
      })
    },
    startP1 () {
      this.$http({
        url: this.$http.adornUrl('/generator/ceshi/testStartP1'),
        method: 'post'
      })
      alert('正在启动项目请等待')
    },
    statusP1 () {
      this.$http({
        url: this.$http.adornUrl('/generator/ceshi/statusP1'),
        method: 'get'
      }).then(result => {
        alert(result.data)
      })
    },
    shutP1 () {
      this.$http({
        url: this.$http.adornUrl('/generator/ceshi/testShutP1'),
        method: 'post'
      })
    },
    startP3 () {
      this.$http({
        url: this.$http.adornUrl('/generator/ceshi/testStartP3'),
        method: 'post'
      })
      alert('正在启动项目请等待')
    },
    statusP3 () {
      this.$http({
        url: this.$http.adornUrl('/subProjectControl//StatusP3'),
        method: 'get'
      }).then(result => {
        alert(result.data)
      })
    },
    shutP3 () {
      this.$http({
        url: this.$http.adornUrl('/generator/ceshi/testShutP3'),
        method: 'post'
      })
    },
    startNginx () {
      this.$http({
        url: this.$http.adornUrl('/generator/ceshi/testStartNginx'),
        method: 'post'
      })
    }

  },
// 生命周期 - 创建完成（可以访问当前this实例）
  created () {

  },
// 生命周期 - 挂载完成（可以访问DOM元素）
  mounted () {

  },
  beforeCreate () {}, // 生命周期 - 创建之前
  beforeMount () {}, // 生命周期 - 挂载之前
  beforeUpdate () {}, // 生命周期 - 更新之前
  updated () {}, // 生命周期 - 更新之后
  beforeDestroy () {}, // 生命周期 - 销毁之前
  destroyed () {}, // 生命周期 - 销毁完成
  activated () {} // 如果页面有keep-alive缓存功能，这个函数会触发
}
</script>
<style>
.lightgreen-box {
	  background-color: rgb(254, 255, 254);
	  height: 150px;
    font-size: 15px;
    text-align: center;
	}
    .button_1 {
    padding: 0;
    /*float: center;*/
    font-size: 15px;
  }

  .image {
    width: 100%;
    display: block;
  }
</style>
<style scoped>

</style>
